<?php

class SystemController extends Controller
{
    public function actionIndex()
    {
        $configs = $this->connection->createCommand("select * from sys_config where module = 'system' order by seq asc ")->queryAll();

        $this->render('index',['configs'=>$configs]);
    }

    public function actionSaveconfig(){
        $systemTitle = $_REQUEST['systemTitle'];
        $systemLogo = $_REQUEST['systemLogo'];

        $this->connection->createCommand("update sys_config set config_value = {$systemTitle} where config_key = 'systemTitle' and module = 'system' ")->execute();
        $this->connection->createCommand("update sys_config set config_value = {$systemLogo} where config_key = 'systemLogo' and module = 'system' ")->execute();

        echo json_encode(Appcode::success);
    }
}